﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("你好！");
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Text = "这是一个应用程序";
            this.BackColor = Color.FromArgb(255, 255, 0);
            this.label1.SetBounds(100,100,200,50);/*设置边距*/
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button2_MouseMove(object sender, MouseEventArgs e)
        {

        }

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            this.label1.Text = $"蜗牛向右爬:({e.X},{e.Y})";
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            this.textBox1.Text = this.textBox2.Text;
            
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.label1.Left += 1;
            this.Text = DateTime.Now.ToString();
            var random = new Random();
            this.label1.BackColor = Color.FromArgb(random.Next(255), random.Next(255), random.Next(255));
        }
    }
}
